{include 'public/header.html'}

<div class="main-content">

<div class="page-content">

  <div class="page-content-area" style="opacity: 0.8;"> <br>

    <div class="page-header">

      <h1> 学生管理 <small><i class="ace-icon fa fa-angle-double-right"></i> {if $row.id}编辑{else}新增{/if}学生 </small> </h1>

    </div>

    <div class="row">

      <div class="panel panel-default">

        <div class="panel-body table-responsive">

          <form method="post" class="form-horizontal" role="form" id="submitform" onsubmit="return false">

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">姓名</label>

                <input type="text" class="form-control" id="name" name="name" value="{$row.name}">

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">班级</label>

                <select name="cid" id="cid" class="form-control">

                  <option value="">请选择</option>

                  {foreach $classes as $v}

                  <option value="{$v.id}" {if $v.id==$row.cid}selected{/if} >{$v.classes}</option>

                  {/foreach}

                </select>

              </div>

            </div>
               <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="name">学生类型</label>
              <select name="s_type" id="s_type" class="form-control">
                  <option value="">请选择</option>
                  <option value="1">住校生</option>
                  <option value="2">走读生</option>
                  
                </select>
              </div>
            </div>
            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">家长</label>

                <input type="text" class="form-control" id="parents" name="parents" value="{$row.parents}">

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">电话</label>

                <input type="text" class="form-control" id="parentsphone" name="parentsphone" value="{$row.parentsphone}">

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="appsecret">卡号</label>

                <textarea class="form-control" name="iccode">{$row.iccode}</textarea>

                <input type="hidden" name="_iccode" value="{md5($row.iccode)}" />

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <button type="submit" class="btn btn-primary btn-lg btn-submit">提交</button>

              </div>

            </div>

          </form>

        </div>

      </div>

    </div>

  </div>

</div>

<script>

var isbusy = false;

$(function(){

	$('#submitform').validate({

		focusInvalid: true,

		rules: {

			//title: {

				//required: true

			//}

		}

	});

	$('.btn-submit').click(function(){

		if(!$('#submitform').valid())return false;

		if(isbusy)return false;

		isbusy = true;

		tooltipbox.show('正在执行操作...');

		$.post(location.href, $('#submitform').serialize(), function(res){

		    if(res.code == 1){

				location.href = '{siteurl("con=admin/student")}';

			}

			tooltipbox.show(res.msg);	

			isbusy = false;

		}, 'json').error(function(a, b, c){

			tooltipbox.show('数据或网络错误');

			isbusy = false;

		});

	});

});

</script> 

{include 'public/footer.html'} 